home *** CD-ROM | disk | FTP | other *** search
/ Treccani Italiana Di Scienze Lettere Ed Arti / [Enciclopedia] Treccani Italiana di scienze lettere ed arti.iso / pc / data / xxi_appendice_dvd.swf / scripts / __Packages / CXXIButton.as < prev    next >
Text File  |  2007-11-08  |  2KB  |  114 lines

  1. class CXXIButton extends MovieClip
  2. {
  3.    function CXXIButton()
  4.    {
  5.       super();
  6.       this.useHandCursor = false;
  7.    }
  8.    function init()
  9.    {
  10.    }
  11.    function onUnload()
  12.    {
  13.    }
  14.    function SetState(inState)
  15.    {
  16.       if(this.enabled)
  17.       {
  18.          if(inState == "up")
  19.          {
  20.             this.gotoAndPlay("up");
  21.          }
  22.          else if(inState == "dw")
  23.          {
  24.             this.gotoAndPlay("dw");
  25.          }
  26.          else if(inState == "rollOver")
  27.          {
  28.             this.gotoAndPlay("rollOver");
  29.          }
  30.          else if(inState == "rollOut")
  31.          {
  32.             this.gotoAndPlay("rollOut");
  33.          }
  34.          else if(inState == "over")
  35.          {
  36.             this.gotoAndPlay("over");
  37.          }
  38.       }
  39.       else if(inState == "disabled")
  40.       {
  41.          this.gotoAndPlay("disabled");
  42.       }
  43.    }
  44.    function onRollOut()
  45.    {
  46.       this.SetState("rollOut");
  47.    }
  48.    function onRollOver()
  49.    {
  50.       this.SetState("rollOver");
  51.    }
  52.    function onPress()
  53.    {
  54.       this.SetState("dw");
  55.    }
  56.    function onRelease()
  57.    {
  58.       this.SetState("over");
  59.       if(this.enabled)
  60.       {
  61.          this.executeCallBack();
  62.       }
  63.    }
  64.    function onDragOut()
  65.    {
  66.       this.SetState("up");
  67.    }
  68.    function onDragOver()
  69.    {
  70.       this.SetState("dw");
  71.    }
  72.    function onReleaseOutside()
  73.    {
  74.       this.SetState("up");
  75.    }
  76.    function SetCallBack(inCallbackObject, inCallbackFunction)
  77.    {
  78.       this.mCallbackFunction = inCallbackFunction;
  79.       this.mCallbackObject = inCallbackObject;
  80.    }
  81.    function executeCallBack()
  82.    {
  83.       if(this.enabled && this.mCallbackFunction)
  84.       {
  85.          this.mCallbackFunction.call(this.mCallbackObject);
  86.       }
  87.    }
  88.    function disable()
  89.    {
  90.       this.enabled = false;
  91.       this.SetState("disabled");
  92.    }
  93.    function enable()
  94.    {
  95.       this.enabled = true;
  96.       this.SetState("up");
  97.    }
  98.    function SetEnabled(inV)
  99.    {
  100.       if(inV == true)
  101.       {
  102.          this.enable();
  103.       }
  104.       else
  105.       {
  106.          this.disable();
  107.       }
  108.    }
  109.    function isEnabled()
  110.    {
  111.       return this.enabled;
  112.    }
  113. }
  114.